package com.example.intenttrial;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.MediaController;

public class PlayerActivity extends Activity {
	  private MediaController mc; 

	    @Override 
	    public void onCreate(Bundle savedInstanceState) { 
	        super.onCreate(savedInstanceState); 

	        LinearLayout v = new LinearLayout(this); 
	        setContentView(v); 

	        mc = new MediaController(this); 
	        
	        mc.setMediaPlayer(player_interface); 
	        
	        mc.setEnabled(true); 
//	        mc.setAnchorView(v); 

	        Button b = new Button(this); 
	        b.setText("show the player"); 
	        b.setOnClickListener(my_click_listener); 

	        v.addView(b); 
	    } 


	    private View.OnClickListener my_click_listener = new 
	View.OnClickListener() { 
	            public void onClick(View v) { 

	                mc.show(1000); 
	            } 
	        }; 

	    private MediaController.MediaPlayerControl player_interface = new 
	MediaController.MediaPlayerControl() { 

	                public int getBufferPercentage() { 
	                        return 75; 
	                } 

	                public int getCurrentPosition() { 
	                        return 25; 
	                } 

	                public int getDuration() { 
	                        return 180; 
	                } 

	                public boolean isPlaying() { 
	                        return true; 
	                } 

	                public void pause() { 
	                } 

	                public void seekTo(int pos) { 
	                } 

	                public void start() { 
	                }

					@Override
					public boolean canPause() {
						// TODO Auto-generated method stub
						return false;
					}

					@Override
					public boolean canSeekBackward() {
						// TODO Auto-generated method stub
						return false;
					}

					@Override
					public boolean canSeekForward() {
						// TODO Auto-generated method stub
						return false;
					} 
	        }; 
}
